<?php
/***********************************************************
    [大米CMS] (C)2011 - 2011 damicms.com
    
	@function 二维码模型管理

    @Filename LinkAction.class.php $

    @Author 追影 QQ:279197963 $

    @Date 2011-11-23 10:26:03 $
*************************************************************/
class QrcodeAction extends CommonAction
{	
//类结束	
    public function index()
    {
        $dao = M('extend_fieldes');
        $list = $dao->where('field_type =5')->order('orders')->select();
        $this->assign('list',$list);
        $this->display('index');
    }
    function edit(){
        //获取token
        $field_id = (int)$_REQUEST['field_id'];
        $list = M('extend_fieldes')->where('field_id='.$field_id)->find();
        if($list['field_type']>2 && $list['field_type']<7){
            foreach (explode(",",$list['set_option']) as $key=> $item){
                
                $_set_tmp=explode('|', $item);
                if ($_set_tmp[0]){
                    $qrCodeUrl= D('Qrcode')->getPublicQrcode($_set_tmp[1],'yunxinchuanying');
                    $set_option[$key]['qrCodeUrl']='https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket='.urlencode($qrCodeUrl['ticket']);
                    $set_option[$key]['id'] =$_set_tmp[1];
                    $set_option[$key]['name'] =$_set_tmp[0];
                    $set_option[$key]['nums'] =$_set_tmp[2]+ M('weixin_member')->where(array('shopId'=>$_set_tmp[1]))->count();
                }
            }
        }
        $this->assign('set_option',$set_option);
        $this->display();
    }
}
?>